#include<iostream>
using namespace std;
const int MAX_N = 1e4 + 1;
int A[MAX_N], B[MAX_N], N;
bool check_min(int V)
{
    for (int i = 1; i <= N; i++)
    {
        if (A[i] / V > B[i])
            return false;
    }
    return true;
}
bool check_max(int V)
{
    for (int i = 1; i <= N; i++)
    {
        if (A[i] / V < B[i])
            return false;
    }
    return true;
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> N;
    for (int i = 1; i <= N; ++i) cin >> A[i] >> B[i];
    int L = 1, R = 1e9, V_min;
    while (L <= R)
    {
        int mid = L + R >> 1;
        if (check_min(mid)) {
            V_min = mid;
            R = mid - 1;
        }
        else L = mid + 1;
    }
    L = 1; R = 1e9;
    int V_max;
    while (L <= R)
    {
        int mid = L + R >> 1;
        if (check_max(mid)) {
            V_max = mid;
            L = mid + 1;   
        }
        else R = mid - 1;
    }   
    cout << V_min << ' ' << V_max << endl;
    return 0;
}

class Solution {
public:
    TreeNode* pruneTree(TreeNode* root) {
        if (root == nullptr) return nullptr;
        root->left = pruneTree(root->left);
        root->right = pruneTree(root->right);

        if (root->left == nullptr && root->right == nullptr && root->val == 0)
        {
            delete root;
            root = nullptr;
        }
        return root;
    }
};
